<template>
	<view class="preview">
		<swiper :autoplay="true" circular="" :interval="3000" :duration="1000">
			<swiper-item v-for="item in 5">
				<image src="/common/images/preview1.jpg" @click="changemask" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		<view class="mask" v-show="maskstate">
			<view class="goback" :style="{top:getstatusbar()+'px'}" @click="goback">
			<uni-icons type="back" color="#fff"></uni-icons>
			</view>
			<view class="count">
				3/9
			</view>
			<view class="time">
				<uni-dateformat :date="new Date()" format="hh:mm"></uni-dateformat>
			</view>
			<view class="date">
				<!-- 一般用法 -->
				<uni-dateformat :date="new Date()" format="MM月dd日"></uni-dateformat>
			</view>
			<view class="footer">
				<view class="box" @click="showinfo">
					<uni-icons type="info" size="23"></uni-icons>
					<view class="text">
						信息
					</view>
				</view>
				<view class="box" @click="starchick">
					<uni-icons type="star" size="23"></uni-icons>
					<view class="text">
						5分
					</view>
				</view>
				<view class="box">
					<uni-icons type="download" size="23"></uni-icons>
					<view class="text">
						下载
					</view>
				</view>

			</view>
		</view>
		<!-- 详细信息弹窗 -->
		<uni-popup ref="infopopup" type="bottom">
			<view class="infopopup">
				<view class="popheader">
					<view></view>
					<view class="titele">
						壁纸信息
					</view>
					<view class="close" @click="closepop">
						<uni-icons type="closeempty" size="18" color="#999"></uni-icons>
					</view>
				</view>
				<scroll-view scroll-y>
					<view class="content">
						<view class="row">
							<view class="lable">
								壁纸id:
							</view>
							<text selectable class="value">adadadadadad</text>
						</view>
						<view class="row">
							<view class="lable">
								分类:
							</view>
							<text selectable class="value">美女明星</text>
						</view>
						<view class="row">
							<view class="lable">
								发布者:
							</view>
							<text selectable class="value">aaaa</text>
						</view>
						<view class="row">
							<view class="lable">
								评分:
							</view>
							<view selectable class="value tote">
								<uni-rate readonly touchable :value="userstart" />
								<text class="score">{{userstart}}分</text>
							</view>
						</view>
						<view class="row">
							<view class="lable">
								摘要:
							</view>
							<text selectable class="value">嗡嗡嗡威威我我我我嗡嗡嗡 威威</text>
						</view>
						<view class="row">
							<view class="lable">
								标签:
							</view>
							<view class="value tabs">
								<view class="tab" v-for="item  in 3">
									标签名
								</view>
							</view>
						</view>
						<view class="row">
							<view class="lable">
								声明:
							</view>
							<text selectable class="value">aaaa</text>
						</view>
						<view class="banquan">
							版权信息
						</view>
					</view>
				</scroll-view>
			</view>
		</uni-popup>
		<!-- 评分弹窗 -->
		<uni-popup type="center" ref="start" :is-mask-click="false">
			<view class="start">
				<view class="popheader">
					<view></view>
					<view class="titele">
						壁纸评分
					</view>
					<view class="close" @click="startclose">
						<uni-icons type="closeempty" size="18" color="#999"></uni-icons>
					</view>
				</view>
				<view class="content">
					<uni-rate v-model="userstart" @change="onChange"  allowHalf/>
					<text class="text">{{userstart}}分</text>
				</view>
				<view class="footer">
					<button @click="submit" type="default" size="mini" plain :disabled="!userstart">确认评分</button>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import { getstatusbar } from '@/utils/system'
	const userstart = ref(0)
	const infopopup = ref(null)
	const start = ref(null)
	const maskstate = ref(true)
	const changemask = () => {
		maskstate.value = !maskstate.value
	}
	//点击信息弹窗
	const showinfo = () => {
		infopopup.value.open()
	}
	//关闭弹框
	const closepop = () => {
		infopopup.value.close()
	}
	//评分弹窗
	const starchick = () => {
		start.value.open()
	}
	//关闭评分弹窗
	const startclose = () => {
		start.value.close()
	}
	//确定评分
	const submit= ()=>{
		start.value.close()
	}
	//返回
	const goback = ()=>{
		uni.navigateBack()
	}
</script>

<style lang="scss" scoped>
	.preview {
		width: 100%;
		height: 100vh;
		position: relative;

		swiper {
			width: 100%;
			height: 100%;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.mask {
			&>view {
				left: 0;
				right: 0;
				margin: auto;
				position: absolute;
				color: #fff;
			}

			.goback {
				width: 60rpx;
				height: 60rpx;
				background: rgba(0,0,0,.5);
				left: 30rpx;
				margin-left: 0;
				border-radius: 100px;
				top: 0;
				backdrop-filter: blur(10rpx);
				border: 1px solid rgba(255,255,255,.3);
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.count {
				width: fit-content;
				top: 10vh;
				background-color: rgba(0, 0, 0, .3);
				font-size: 29rpx;
				border-radius: 40rpx;
				padding: 8rpx 28rpx;
			}

			.time {
				width: fit-content;
				font-size: 140rpx;
				top: calc(10vh + 80rpx);
				font-weight: 100;
				line-height: 1em;
				text-shadow: 0 4rpx rgba(0, 0, 0, .3);
			}

			.date {
				width: fit-content;
				font-size: 34rpx;
				top: calc(10vh + 210rpx);
				text-shadow: 0 2rpx rgba(0, 0, 0, 0.3);
			}

			.footer {
				width: 65vw;
				height: 120rpx;
				background-color: rgba(255, 255, 255, .8);
				bottom: 10vh;
				border-radius: 120rpx;
				display: flex;
				justify-content: space-around;
				align-items: center;
				box-shadow: 0 2rpx 0 rgba(0, 0, 0, .4);
				backdrop-filter: blur(20rpx);

				.box {
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					padding: 2rpx 12rpx;

					.text {
						font-size: 26rpx;
						color: #111;
					}
				}
			}
		}

		.popheader {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.titele {
				color: #111;
				font-size: 26rpx
			}

			.close {
				padding: 6rpx;
			}
		}

		.infopopup {
			background: #fff;
			padding: 30rpx;
			border-radius: 30rpx 30rpx 0 0;

			scroll-view {
				max-height: 50vh;

				.content {
					.row {
						display: flex;
						padding: 16rpx 0;
						font-size: 32rpx;
						line-height: 1.7em;

						.lable {
							color: rgb(157, 157, 157);
							width: 140rpx;
							text-align: right;
							font-size: 30rpx;
							margin-right: 20rpx;
						}

						.value {
							flex: 1;
							width: 0;
						}

						.tote {
							display: flex;
							align-items: center;

							.score {
								font-size: 26rpx;
								color: rgb(157, 157, 157);
								padding-left: 10rpx;
							}
						}

						.tabs {
							display: flex;
							flex-wrap: wrap;
							align-items: center;

							.tab {
								border: 1px solid rgb(102, 217, 239);
								color: rgb(102, 217, 239);
								font-size: 22rpx;
								padding: 10rpx 30rpx;
								border-radius: 40rpx;
								line-height: 1em;
								margin: 0 10rpx 10rpx 0;
							}
						}
					}

					.banquan {
						font-size: 28rpx;
						padding: 20rpx;
						background: #f6f6f6;
						color: #666;
						border-radius: 10rpx;
						margin: 20rpx 0;
						line-height: 1.6em;
					}
				}
			}
		}

		.start {
			background-color: #fff;
			padding: 30rpx;
			width: 70vw;
			border-radius: 30rpx;
			.content {
				padding: 30rpx 0 ;
				display: flex;
				justify-content: center;
				align-items: center;
				.text {
					color: #ffca3e;
					padding-left: 10rpx;
					width: 80rpx;
					line-height: 1em;
					text-align: right;
				}
				
			}
			.footer {
				padding: 10rpx 0; 
				display: flex;
				justify-content: center;
				align-items: center;
			}

		}
	}
</style>